package com.carefree.bookmall.service;


import com.carefree.bookmall.common.vo.OrderPayVo;
import com.carefree.bookmall.common.vo.PageVO;
import com.carefree.bookmall.entity.Order;
import com.carefree.bookmall.exception.CustomException;

import java.util.List;

/**
 * @author Aurora
 */
public interface OrderService {

    /**
     * 添加订单信息
     *
     * @param order 客户端订单信息
     * @return
     * @throws CustomException
     */
    public boolean addOrder(Order order) throws CustomException;

    /**
     * 根据用户id查询订单信息
     *
     * @param userId 用户id
     * @return 订单list
     * @throws CustomException
     */
    public List<Order> queryOrderByUserId(Integer userId) throws CustomException;

    /**
     * 根据订单状态分页查询订单信息
     *
     * @param status     订单状态
     * @param pageNumber 页码
     * @param pageSize   每页显示记录数
     * @return
     */
    public PageVO queryOrdersByStatus(Integer status, int pageNumber, int pageSize);

    /**
     * 修改订单状态
     *
     * @param orderId 订单号
     * @param status  订单状态
     * @return
     * @throws CustomException
     */
    public boolean updateOrderStatus(String orderId, Integer status) throws CustomException;

    /**
     * 根据订单id删除订单信息
     *
     * @param orderId 订单号
     * @return
     * @throws CustomException
     */
    public boolean deleteOrderByOrderId(String orderId) throws CustomException;

    /**
     * 查询今日收入
     *
     * @return
     */
    public Double queryTodayIncoming();

    /**
     * 查询订单总数
     *
     * @return 查询总数
     */
    public int queryOrderCounts();

    /**
     * 删除指定用户指定的订单
     *
     * @param orderId 订单号
     * @param userId  用户id
     * @return
     * @throws CustomException
     */
    public boolean removeOrderByIdAndUserId(String orderId, Integer userId) throws CustomException;

    /**
     * 根据订单编号查询订单
     *
     * @param orderId 订单号
     * @param userId  用户id
     * @return
     * @throws CustomException
     */
    public Order queryOrderById(String orderId, Integer userId) throws CustomException;

    /**
     * * 修改订单（支付）
     *
     * @param orderId 订单号
     * @param paytype 支付类型
     * @param userId  用户id
     * @param status  订单状态（3：已付款）
     * @return true/flase
     * @throws CustomException
     */
    public boolean modifyOrderByIdAndUserId(String orderId, Integer paytype, Integer status) throws CustomException;

    /**
     * 查询订单支付信息
     *
     * @param orderId 订单号
     * @param userId  用户id
     * @return
     */
    OrderPayVo queryOrderPayInfo(String orderId, Integer userId) throws CustomException;
}
